package leedcode_path.treeNoDE;

public class 左叶子之和 {

        public int sumOfLeftLeaves(TreeNode root) {
            if (root==null) return 0;
            if (root.left!=null&&root.right!=null){
                return 0;
            }
            int left= sumOfLeftLeaves(root.left);
            if (root.left!=null&&root.left.left==null&&root.left.right==null) {
                left=root.left.val;
            }
            int right=sumOfLeftLeaves(root.right);
            int sum=left+right;
            return sum;



        }

}
